<?php
/**
 * 后台站点设置模型
 * AdminSite.php
 * ==============================================
 * 版权所有 2013-2014
 * ----------------------------------------------
 * 这不是一个自由软件，未经授权不许任何使用和传播。
 * ----------------------------------------------
 * 
 * @package xcs
 * @author Huangdaohai <huangdaohai.2007@163.com>
 * @version $Id$
 * @access public
 */
class AdminSite extends AdminModel
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return AdminRole the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{admin_site}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('siteid, name, dirname, domain, site_title ,keywords ,description ,release_point ,default_style ,template ,setting ,watermark', 'safe'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'siteid' => '站点ID',
			'name' => '站名名称',
			'dirname' => '站点根目录',
			'domain' => '域名',
			'site_title' => '标题',
            'keywords' => '关键词',
            'description' => '描述',
            'release_point' => '发布点',
            'default_style' => '默认风格',
            'setting' => '配置',
            'upload_maxsize'=>'允许上传附件大小',
            'upload_type'=>'允许上传类型',
            'watermark' => '是否启用水印'
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('siteid',$this->siteid);
		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}